package com.study.lu.链表.bean;

public class Node {
    public Object data;
    public Node next;

    public Node(Object data) {
        this.data = data;
        this.next = null;
    }

    public Node(Object data,Node next) {
        this.data = data;
        this.next = next;
    }


    public static Node createNode(String str) {
        if (null == str || 0 == str.trim().length()) {
            return null;
        }
        String[] split = str.split("");
        Node head = null;
        Node tail = null;
        for (int i = 0; i < split.length; i++) {
            Node node = new Node(split[i]);
            if (null == head) {
                head = node;
            } else {
                tail.next = node;
            }
            tail = node;
        }
        return head;
    }

}
